#include "env.h"

#include "tool/tool.h"

#include "tcpsocket.h"
#include "flatbuffer.h"
#include "tcpaccepter.h"
#include "epollreactor.h"

#include "service.h"

namespace net {

IService* GetService() {
    return Singleton<Service>();
}

net::ISocket* GetSocket() {
	return new net::TCPSocket();
}

net::ISocket* GetSocket(int fd) {
	return new net::TCPSocket(fd);
}

net::IBuffer* GetBuffer() {
	return new net::FlatBuffer();
}

net::IReactor* GetReactor() {
	static net::EpollReactor instance;
	return &instance;
}

net::IAccepter* GetAccepter() {
	return new net::TCPAccepter();
}

}
